﻿using System;
using System.Collections.Generic;
using System.Text;
using Test.Examples;
using Test.Data;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.ComponentModel;
using System.Diagnostics;
using System.Xml.Serialization;

namespace Test {
	class Program {
		static void Main(string[] args) {
			XmlAttributeOverrides att = new XmlAttributeOverrides();
			
			XmlSerializer xs = new XmlSerializer(typeof(PerformanceObject));
		}
		static void TestType() {
			Double total = 0;
			Int32 c = 10;
			for (int i = 0; i < c; i++) {
				total += TestPerformance();
			}
			Console.WriteLine("Avg: {0}ms", (total / c));
		}
		static Int32 TestPerformance() {
			Stopwatch watch = new Stopwatch();
			watch.Start();
			PerformanceObject o = new PerformanceObject();
			for (int i = 0; i < 100000; i++) {
				o.Index = i + i;
				o.Value = o.Index + o.Value + i;
			}

			watch.Stop();
			return (Int32)watch.ElapsedMilliseconds;
		}
	}
	public class PerformanceObject : PackageBase {
		public static readonly PackageProperty IndexProperty = PackageProperty.Register("Index", typeof(Int32), typeof(PerformanceObject));
		public static readonly PackageProperty ValueProperty = PackageProperty.Register("Value", typeof(Int32), typeof(Nullable));

		public Int32 Index {
			get {
				return (Int32)GetValue(IndexProperty);
			}
			set {
				this.SetValue(IndexProperty, value);
			}
		}
		public Int32 Value {
			get {
				return (Int32)GetValue(null);
			}
			set {
				this.SetValue(ValueProperty, value);
			}
		}

	}
}
